//
//  ViewController.swift
//  SwiftCodableBuilder
//
//  Created by Caijinglong on 2017/11/22.
//  Copyright © 2017年 kikt. All rights reserved.
//

import Cocoa

class ViewController: NSViewController {

    @IBOutlet weak var tvJson: NSTextField!
    @IBOutlet weak var btMake: NSButton!
    @IBOutlet weak var tvResult: NSTextField!
    
    @IBOutlet weak var optType: NSPopUpButton!
    @IBOutlet weak var result: NSScrollView!
    
    @IBOutlet var nsTextResult: NSTextView!
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
    }

    override var representedObject: Any? {
        didSet {
        // Update the view, if already loaded.
        }
    }

    @IBAction func make(_ sender: Any) {
        let value = tvJson.stringValue
        let type = optType.indexOfSelectedItem
        let result = SwiftMakerHelper.make(jsonStr: value, objName: "Resp",type: type)
        tvResult.stringValue = result
        nsTextResult.string = result
    }
    
}

